System, method and computer program product for storing file system content in a multi-tenant on-demand database system

ABSTRACT

In accordance with embodiments, there are provided mechanisms and methods for storing file system content in a multi-tenant on-demand database system. These mechanisms and methods for storing file system content in a multi-tenant on-demand database system can enable embodiments to reduce a number of files stored on a file system, avoid copying of all file system content to file system copies, etc.

CLAIM OF PRIORITY

This application claims the benefit of U.S. Provisional PatentApplication 61/307,798, entitled “File Force Bundler,” by Hansma et al.,filed Feb. 24, 2010 (Attorney Docket No. SFC1P059+/171PROV), and U.S.Provisional Patent Application 61/307,800, entitled “Fileforce No CopyOn Sandbox Copy,” by Hansma et al., filed Feb. 24, 2010 (Attorney DocketNo. SFC1P060+/172PROV), the entire contents of which are incorporatedherein by reference.

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains materialwhich is subject to copyright protection. The copyright owner has noobjection to the facsimile reproduction by anyone of the patent documentor the patent disclosure, as it appears in the Patent and TrademarkOffice patent file or records, but otherwise reserves all copyrightrights whatsoever.

FIELD OF THE INVENTION

One or more implementations relate generally to storing content, andmore particularly to storing content in a file system.

BACKGROUND

The subject matter discussed in the background section should not beassumed to be prior art merely as a result of its mention in thebackground section. Similarly, a problem mentioned in the backgroundsection or associated with the subject matter of the background sectionshould not be assumed to have been previously recognized in the priorart. The subject matter in the background section merely representsdifferent approaches, which in and of themselves may also be inventions.

In conventional file systems, content is stored for providing accessthereto by users, applications, etc. In particular, files are generallystored by the systems for being retrieved, written to, etc.Unfortunately, conventional file systems have been associated withvarious limitations.

For example, such files systems have generally performed poorly withrespect to storing a large number of different files, but havenonetheless allowed storage of content regardless of its size. Asanother example, when a copy of the file system is created for anypurpose, all of the content stored in the file system is required to becopied over to file system copy, which is time consuming and many timesresource intensive. Accordingly, it is desirable to provide techniquesreducing a number of files stored on a file system, avoiding copying ofall file system content to the system copies, etc.

BRIEF SUMMARY

In accordance with embodiments, there are provided mechanisms andmethods for storing file system content in a multi-tenant on-demanddatabase system. These mechanisms and methods for storing file systemcontent in a multi-tenant on-demand database system can enableembodiments to reduce a number of files stored on a file system, avoidcopying of all file system content to file system copies, etc.

In an embodiment and by way of example, a method for storing file systemcontent in a multi-tenant on-demand database system is provided. In oneembodiment, a plurality of files located on a multi-tenant on-demanddatabase system is identified, where each file is below a thresholdsize. Additionally, the files are concatenated to create a singleconcatenated file. Further, the single concatenated file is stored in afile system of the multi-tenant on-demand database system. In anotherembodiment, content stored in a file system of a first device of amulti-tenant on-demand database system is identified. Moreover, areference to the content is stored on a second device of themulti-tenant on-demand database system for maintaining on the seconddevice a copy of at least a portion of memory of the first device.

While one or more implementations and techniques are described withreference to an embodiment in which storing file system content in amulti-tenant on-demand database system is implemented in a system havingan application server providing a front end for an on-demand databaseservice capable of supporting multiple tenants, the one or moreimplementations and techniques are not limited to multi-tenant databasesnor deployment on application servers. Embodiments may be practicedusing other database architectures, i.e., ORACLE®, DB2® by IBM and thelike without departing from the scope of the embodiments claimed.

Any of the above embodiments may be used alone or together with oneanother in any combination. The one or more implementations encompassedwithin this specification may also include embodiments that are onlypartially mentioned or alluded to or are not mentioned or alluded to atall in this brief summary or in the abstract. Although variousembodiments may have been motivated by various deficiencies with theprior art, which may be discussed or alluded to in one or more places inthe specification, the embodiments do not necessarily address any ofthese deficiencies. In other words, different embodiments may addressdifferent deficiencies that may be discussed in the specification. Someembodiments may only partially address some deficiencies or just onedeficiency that may be discussed in the specification, and someembodiments may not address any of these deficiencies.

BRIEF DESCRIPTION OF THE DRAWINGS

In the following drawings like reference numbers are used to refer tolike elements. Although the following figures depict various examples,the one or more implementations are not limited to the examples depictedin the figures.

FIG. 1 illustrates a method for concatenating files in a multi-tenanton-demand database system, in accordance with one embodiment;

FIG. 2 illustrates a method for identifying a location at which to writefiles based on a threshold size, in accordance with another embodiment;

FIG. 3 illustrates a method for concatenating files for storage in afile system, in accordance with yet another embodiment;

FIG. 4 illustrates a method for maintaining a copy of memory of a firstdevice on a second device utilizing content references, in accordancewith one embodiment;

FIG. 5 illustrates a system for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in accordance with another embodiment;

FIG. 6 illustrates a system for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in response to deletion of the reference to the file on one of thesandbox devices, in accordance with another embodiment;

FIG. 7 illustrates a system for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in response to deletion of one of the sandbox devices, in accordancewith another embodiment;

FIG. 8 illustrates a system for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in response to a request to migrate the file from the source device toanother source device, in accordance with still yet another embodiment;

FIG. 9 illustrates a block diagram of an example of an environmentwherein an on-demand database service might be used; and

FIG. 10 illustrates a block diagram of an embodiment of elements of FIG.9 and various possible interconnections between these elements.

DETAILED DESCRIPTION General Overview

Systems and methods are pr vided for storing file system content in amulti-tenant on-demand database system.

As used herein, the term multi-tenant database system refers to thosesystems in which various elements of hardware and software of thedatabase system may be shared by one or more customers. For example, agiven application server may simultaneously process requests for a greatnumber of customers, and a given database table may store rows for apotentially much greater number of customers. As used herein, the termquery plan refers to a set of steps used to access information in adatabase system.

Next, mechanisms and methods for storing file system content in amulti-tenant on-demand database system will be described with referenceto example embodiments.

FIG. 1 illustrates a method 100 for concatenating files in amulti-tenant on-demand database system, in accordance with oneembodiment. As shown in operation 102, a plurality of files located on amulti-tenant on-demand database system is identified, where each file isbelow a threshold size. With respect to the present description, thefiles may each include any data structure storing data, where the datastructure is below the threshold size. For example, the files may eachinclude a text file, an image file, a video file, etc.

Further, in various embodiments, the files may be stored in a filesystem of the multi-tenant on-demand database system, a database of themulti-tenant on-demand database system (e.g. separate from the filesystem), or any other location (or combination of locations) of themulti-tenant on-demand database system. With respect to the presentembodiment, such file system includes a system of a multi-tenanton-demand database system that is utilized for storing files (e.g. andwhich is separate from a database of the multi-tenant on-demand databasesystem). Just by way of example, in response to a request to store eachof the files in the file system, a size of the file may be determinedsuch that if the file is above (or equal to) the threshold size, thefile may be stored in the file system, whereas if the file is below thethreshold size, the file may be stored in the database. To this end, thefiles may be identified from the database, the file system, etc. or anycombination thereof.

Optionally, the files may be identified in response to a determinationthat each of such files is below the threshold size. Thus, only filesbelow the threshold size may be identified. It should be noted that thethreshold size may be pre-configured in any desired manner (e.g. by auser, etc.).

It should be noted that, as described above, such multi-tenant on-demanddatabase service may include any service that relies on a databasesystem that is accessible over a network, in which various elements ofhardware and software of the database system may be shared by one ormore customers (e.g. tenants). For instance, a given application servermay simultaneously process requests for a great number of customers, anda given database table may store rows for a potentially much greaternumber of customers. Various examples of such a multi-tenant on-demanddatabase service will be set forth in the context of differentembodiments that will be described during reference to subsequentfigures.

Additionally, as shown in operation 104, the files are concatenated tocreate a single concatenated file. With respect to the presentdescription, concatenating the files may include aggregating the filesin any manner that results in the single concatenated file. Thus, thefiles that are each of less than the threshold size may be concatenatedto form a single concatenated file that is larger in size than each ofthe files individually.

In one embodiment, the files may be concatenated into the singleconcatenated file according to a predetermined format. For example, thesingle concatenated file may store data including each of the files, andfor each of the files an indicator of a length of the file and achecksum of the file. As another example, the single concatenated filemay store a checksum of all of the aforementioned data stored in thesingle concatenated file. It should be noted that by including theaforementioned checksum(s), the files included in the singleconcatenated file and/or the single concatenated file itself may bevalidated. Of course, however, the single concatenated file may onlyinclude the files appended to one another, or may include any otherpredetermined format.

Table 1 illustrates one example of the predetermined format which may beutilized for concatenating the files into the single concatenated file.Of course, it should be noted that the predetermined format shown inTable 1 is set forth for illustrative purposes only, and thus should notbe construed as limiting in any manner.

TABLE 1 [checksum of single concatenated file][length of firstfile][checksum of first file][first file][length of secondfile][checksum of second file][second file]...[length of nthfile][checksum of nth file][nth file]

Further, as shown in operation 106, the single concatenated file isstored in a file system of the multi-tenant on-demand database system.Such file system may include the file system described above from whichthe files below the threshold size may be identified. With respect tothe present description, storing the single concatenated file in thefile system may include writing such single concatenated file to thefile system.

Optionally, in response to the storage of the single concatenated filein the file system, the files (identified in operation 102) may bedeleted and a pointer to each of the files may be stored. The pointerstored for a file may point to the single concatenated file, in oneembodiment. In another embodiment, the pointer stored for a particularfile may point to an offset (e.g. byte offset) in the singleconcatenated file associated with the file. For example, the offset mayinclude a beginning of the file in the single concatenated file, achecksum of the file in the single concatenated file, etc. By storingsuch pointers, a particular file included in the single concatenatedfile may be directly accessed (e.g. without necessarily reading theentire single concatenated file or a portion of the single concatenatedfile that is larger than the file to be accessed).

As a further option, the pointers may be stored in a database separatefrom the file system. For example, such database may include theaforementioned database from which the files may be identified (inoperation 102). In this way, the file system may optionally avoidstoring a plurality of files each below a threshold size, and insteadmay store a single concatenated file of a larger size which includessuch files.

FIG. 2 illustrates a method 200 for identifying a location at which towrite files based on a threshold size, in accordance with anotherembodiment. As an option, the present method 200 may be carried out inthe context of the functionality of FIG. 1. Of course, however, themethod 200 may be carried out in any desired environment. Theaforementioned definitions may apply during the present description.

As shown in decision 202, it is determined whether a file is receivedfor storage in a file system. Thus, the determination may includedetermining whether a request to write a file to the file system of themulti-tenant on-demand database system has been received. Optionally,such file may be received from a tenant of the multi-tenant on-demanddatabase system.

If it is determined that such a file has not been received, the method200 continues to wait for a file to be received. In response to adetermination that a file has been received, it is further determinedwhether the file is below a threshold size. Note decision 204. Thethreshold size may include any preconfigured size. Just by way ofexample, the threshold size may include 32 kilobyte (KB), a page size,or other standard database read size, etc.

It should be noted that as another option, it may be determined whetherthe file is between a first threshold size (e.g. 1 KB) and secondthreshold size (e.g. 3 KB). Thus, operation 204 may include, in oneexemplary embodiment, determining whether the file is within apreconfigured size range.

If it is determined that the file is not below the threshold size, thefile is written to the file system, as shown in operation 206. In thisway, a file that is equal to or above the threshold size and which isreceived for storage in a file system may be directly written to thefile system. In the aforementioned exemplary embodiment where it isdetermined in operation 204 whether the file is within the preconfiguredsize range, the file may be written to the file system if the file isabove (i.e. larger than) the sizes included in the preconfigured sizerange (e.g. to maximize disk storage and minimize read accesses).

If it is determined that the file is below the threshold size, the filemay be written to a database separate from the file system, as shown inoperation 208. Thus, a file that is below the threshold size which isreceived for storage in a file system may be prevented from beingdirectly stored in the file system. In the aforementioned exemplaryembodiment where it is determined in operation 204 whether the file iswithin the preconfigured size range, the file may be written to thedatabase if the file is within the preconfigured size range or below(i.e. smaller than) the sizes included in the preconfigured size range.

FIG. 3 illustrates a method 300 for concatenating files for storage in afile system, in accordance with yet another embodiment. As an option,the present method 300 may be carried out in the context of thefunctionality of FIGS. 1-2. Of course, however, the method 300 may becarried out in any desired environment. Again, the aforementioneddefinitions may apply during the present description.

As shown in decision 302, it is determined whether it is a predeterminedtime. Such predetermined time may include any particular time of day,etc. which is preconfigured. In this way, the present method 300 mayoptionally only be performed periodically (i.e. at the predeterminedtime).

If it is determined that the predetermined time has not occurred, themethod 300 continues to wait for the predetermined time to occur. Onceit is determined that the predetermined time has occurred, files storedin a database are retrieved. Note operation 304. Such database mayinclude the database described above with respect to FIG. 2, in whichfiles of less than a threshold size are stored. To this end, only filesof less than the threshold size may be retrieved from the database.

As an option, the retrieved files may include files that are onlyassociated with a single tenant of a multi-tenant on-demand databasesystem that includes the database. Thus, the retrieved files may notnecessarily span multiple tenants of the multi-tenant on-demand databasesystem. In one exemplary embodiment, the database from which the filesare retrieved may be dedicated to one of the tenants in the multi-tenanton-demand database system, such that only files associated with (e.g.created by, maintained by, utilized by, etc.) the tenant may be storedin the database. As yet another option, the retrieved files may only beretrieved from a single database of the multi-tenant on-demand databaseservice.

As another option, the retrieved files may include a predeterminednumber of files (e.g. 100 files, etc.). For example, while not shown,the files may optionally only be retrieved if it is determined that atleast the predetermined number of files is stored in the database. Thus,if the database stores less than the predetermined number, the method300 may terminate. However, if the database stores more than thepredetermined number, only the predetermined number of files may beretrieved from the database (i.e. with the remaining files maintained inthe database for optional retrieval during a subsequent execution of themethod 300).

Furthermore, as shown in operation 306, the retrieved files areconcatenated into a single concatenated file. Thus, the singleconcatenated file may store the content of each of the retrieved files.Of course, the single concatenated file may also store any other dataassociated with the content of each of the retrieved files (e.g. basedon a predetermined format, etc.).

Still yet, the single concatenated file is written to a file system.Note operation 308. Such file system may include the file systemdescribed above with respect FIG. 2, in which files above the thresholdsize are stored. In this way, the file system may optionally only storefiles above the threshold size, including the single concatenated filesand any other concatenated files generated utilizing the method 300described above.

It should be noted that the files retrieved in operation 304 and thesingle concatenated file may be further managed in any desired manner.In one embodiment, the retrieved files may be deleted upon storage ofthe single concatenated file in the file system, or otherwise uponretrieval thereof for inclusion in the single concatenated file.Further, upon deletion of the retrieved files, a reference (e.g.pointer) to each of the files in the single concatenated file may bestored in the database. In this way, upon receipt of a request to accessone of the files included in the single concatenated file, the referencemay identify the single concatenated file and optionally an offsetthereof for use in accessing the file.

In another embodiment, in response to a request (e.g. from a tenant,etc.) to delete one of the files included in a concatenated file, thefile may be prevented from being removed from the concatenated file.However, as an option, a counter stored in the database for the singleconcatenated file (e.g. which counts a number of files included in thesingle concatenated file, and is optionally generated upon creation ofthe single concatenated file) may be decremented to reflect that thesingle concatenated file is utilized for storing one less accessiblefile. Furthermore, an entry of the database storing informationdescribing (e.g. utilized for tracking) the single concatenated file maybe updated to indicate which of the files (e.g. which offset, etc.)included in the single concatenated file has been requested to bedeleted (e.g. and is no longer available for use).

In yet another embodiment, a periodic process may inspect the singleconcatenated file stored in the file system by retrieving informationassociated therewith that is stored in the database. For example, thecounter stored in the database for the single concatenated file may beread for determining whether the count identified by the counter isbelow a threshold count. If it is determined that the count is below thethreshold count, additional files may be retrieved from the database andconcatenated with the single concatenated file (i.e. concatenated withthe files already included in the single concatenated file, such thatthe single concatenated file subsequently includes the predeterminednumber of files described above). As another option, if it is determinedthat the count is below the threshold count, the single concatenatedfile may be concatenated with another single concatenated file having acount below the threshold count.

Just by way of example, in response to receipt of a request to deleteone of the files which has been included in the single concatenatedfile, a flag may be stored in an entry of the database associated withthe one of the files (e.g. for indicating the requested deletion of thefile). Periodically, it may be determined whether flagged files includedin the single concatenated file are of at least a predetermined size(e.g. or whether there are least a predetermined number of the flaggedfiles included in the single concatenated file). In response to adetermination that the flagged files included in the single concatenatedfile are of at least the predetermined size, the single concatenatedfile may be concatenated with another single concatenated file or withat least one other file located in the multi-tenant on-demand databasesystem that is below the threshold size.

In still yet another embodiment, the above described periodic processused to inspect the single concatenated file stored in the file systemmay read the counter stored in the database for the single concatenatedfile for determining whether the count identified by the counter is zero(e.g. indicating that all files included in the single concatenated filehave been requested to be deleted). If it is determined that the countis zero, the single concatenated file may be deleted. Optionally, aquery may be run in the database to verify that there are not anyexisting references to the single concatenated file, prior to allowingthe deleting of the single concatenated file.

Optionally, if a request to update (e.g. write to, modify, etc.) a fileexisting in the single concatenated file is received, the file may beread from the single concatenated file. The file existing in the singleconcatenated file may be handled in the same manner as if a request todelete the file were received (e.g. by flagging the entry of thedatabase associated with the file, etc.). Further, the read file may beupdated as requested and stored according to the method 200 of FIG. 2and the method 300 of FIG. 3, such that the updated file may be directlystored in the file system or optionally subsequently included in anothersingle concatenated file for storage in the file system.

FIG. 4 illustrates a method for maintaining a copy of memory of a firstdevice on a second device utilizing content references, in accordancewith one embodiment. As shown in operation 402, content stored in a thesystem of a first device of a multi-tenant on-demand database system isidentified. With respect to the present description, the contentincludes any type of data capable of being stored in a file system of adevice of the multi-tenant on-demand database system. For example, invarious embodiments, the content may include a file (e.g. text file, animage file, a video file, an executable file, etc.) of the file system.

In addition, the first device on which the content is stored may includeany server or other device of the multi-tenant on-demand database systemthat has a file system thereon for storing the content. In oneembodiment, the first device may include an application server of themulti-tenant on-demand database system, which stores content created,maintained, managed, etc. by at least one tenant of the multi-tenanton-demand database system. In another embodiment, the first device mayinclude a source device, as described in more detail below.

As an option, the content may be identified in response to a request tocreate a copy of at least a portion of memory of the first device (e.g.by the aforementioned tenant of the multi-tenant on-demand databasesystem). For example, such portion of memory may include that whichincludes the file system or the portion thereof storing the content. Thecopy may be requested for creating a sandbox organization in whichchanges, applications, etc. may be tested, in one exemplary embodiment.With respect to the present description, the sandbox organization mayinclude any other tenant organization (e.g. separate from the firstdevice), which may optionally be on another database of the multi-tenanton-demand database system.

Further, as shown in operation 404, a reference to the content is storedon a second device of the multi-tenant on-demand database system formaintaining on the second device a copy of at least a portion of memoryof the first device. It should be noted that the second device mayinclude any server or other device of the multi-tenant on-demanddatabase system which is separate from the first device and which iscapable of storing a reference to the content identified from the firstdevice. For example, the second device may be in communication with thefirst device (e.g. via a network) for identifying the content such thatthe reference thereto may be stored.

As noted above, the reference to the content is stored on the seconddevice such that a copy of the memory (or portion thereof) of the firstdevice is maintained (e.g. created, etc.) on the second device. Thus,the second device may include a copy of the first (e.g. source) device.In one exemplary embodiment, the second device may include a sandboxorganization copy of the memory (or portion thereof) of the firstdevice. For example, the sandbox organization copy may be utilized fortesting changes, execution of applications, etc. prior to applicationthereof to the memory of the first device.

As also noted above, the content may include a file in the file systemof the first device. Further, the reference may include a pointer to thefile. Of course, however, the reference may include any informationcapable of being utilized to reference (e.g. locate, etc.) the content.

In one embodiment, the reference may be stored in a database located onthe second device. For example, the database may be utilized fortracking files capable of being utilized by the second device and storedon the first device. As an option, a tenant identifier of the firstdevice storing the content may also be stored with the reference, suchthat the first device on which the content is stored may be identifiableby the second device for use in accessing the file. By storing thereference to the content on the second device, the second device maymaintain a copy of the memory (or portion thereof) without storing thecontent itself, thus reducing the memory utilized by the second device,reducing resource consumption associated with transferring a copy of thecontent from the first device to the second device, etc.

It should be noted that while only a single second device is describedabove, the reference to the content may be stored on multiple differentsecond devices, each maintaining a copy of the memory (or portionthereof) of the first device. For example, each of the second devicesmay include a separate sandbox organization copy of the first device(e.g. for use with respect to different types of testing, etc.). Itshould also be noted that while only a single piece of content isdescribed above, the second device may store references to any contentstored in a file system of the first device such that a copy of thememory (or portion thereof) of the first device may be maintained by thesecond device.

Moreover, due to the reference to the content stored on the seconddevice, deletion of the content at the first device may be handledaccording to predefined rules, as described in more detail below withrespect to FIGS. 5-8.

FIG. 5 illustrates a system 500 for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in accordance with another embodiment. As an option, the present system500 may be implemented in the context of the functionality of FIG. 4. Ofcourse, however, the system 500 may be implemented in any desiredenvironment. Again, the aforementioned definitions may apply during thepresent description.

As shown, a source device 501 and at least one sandbox device 508 (e.g.sandbox organization as shown) are in communication (e.g. via a network,etc.). Thus, while a single sandbox device 508 is described below, itshould be noted that the system 500 may be implemented with any numberof different sandbox devices 508. Further, the source device 501 may becapable of identifying the sandbox devices 508 by keeping track of theexistent sandbox devices 508 in a database at the source device 501.

With respect to the present embodiment, the source device 501 stores afile in a file system of the source device 501, and the sandbox device508 stores a reference to such file for maintaining a copy of at least aportion of memory of the source device 501. Also with respect to thepresent embodiment, the file on the source device 501 is attempted to bedeleted (e.g. as a result of a request from a tenant of a multi-tenanton-demand database system, etc.). In response to the attempt, the sourcedevice 501 communicates with the sandbox device 508, as described below.

Initially, a delete message queue handler 502 of the source device 501receives a request to delete a file stored in a file system of thesource device 501. The delete message queue handler 502 may include anyqueue (e.g. of a queued message system) capable of being utilized forqueuing requests to delete content stored in the file system of thesource device 501. For example, the delete message queue handler 502 maybe provided by Oracle® Advanced Queuing.

In response to the receipt of the request, the delete message queuehandler 502 queues the request, and subsequently initiates execution ofa polling method 504 of the source device 501. The polling method 504may include any executable method capable of being utilized to determinewhether the sandbox 508 stores a reference to the file requested to bedeleted. For example, the polling method 504 may include a Java® methodor other code for requesting from the sandbox device 508 an indicationof whether the sandbox device 508 stores the reference to the filerequested to be deleted.

As shown, a cross-instance handler 506 of the sandbox device 508receives communication from the polling method 504 (i.e. theaforementioned request for the indication of whether the sandbox device508 stores the reference to the file requested to be deleted), andresponds to such communication. Thus, the cross-instance handler 506 maydetermine whether the reference is stored by the sandbox device 508, andmay respond accordingly. It should be noted that the cross-instancehandler 506 may include any code or process capable of being utilized torespond to communications from the polling method 504 of the sourcedevice 501.

As further shown, the source device 501 deletes the file if the responsereceived from the cross-instance handler 506 indicates that thereference to the file is not stored on the sandbox device 508. Inanother embodiment, the source device 501 may be prevented from deletingthe file if the response received from the cross-instance handler 506indicates that the reference to the is stored on the sandbox device 508.In this way, the source device 501 may only be allowed to delete filesfor which no reference exists on the sandbox device 508 (e.g. to preventthe sandbox device 508 from referencing a non-existent file of thesource device 501).

As an option, the source device 501 may instruct the sandbox device 508to store a local copy of the file requested to be deleted, if theresponse received from the cross-instance handler 506 indicates that thereference to the file is stored on the sandbox device 508. In this way,the source device 501 may delete the file upon the sandbox device 508storing the copy of the file thereon.

It should be noted that where a plurality of sandbox devices 508 exist,each with a potential reference to the file requested to be deleted, thepolling method 504 may request from each of the sandbox devices 508 anindication of whether the sandbox devices 508 store the reference to thefile requested to be deleted. If any one of the sandbox devices 508responds that a reference to the file is stored thereon, the sourcedevice 501 may be prevented from deleting the file. However, a databaseentry utilized for tracking the file may be flagged, for indicating thatthe has been requested to be deleted (the purpose of which will bedescribed below in more detail with respect to the subsequent FIGS.6-8). As another option, if any of the sandbox devices 508 fails torespond to a request issued by the polling method 504, the pollingmethod 504 may instruct the delete message queue handler 502 to re-queuethe request to delete the file (e.g. such that the polling method 504may again be initiated with respect to the request to delete the file).As yet another option, the source device 501 may instruct only one ofthe plurality of sandbox devices 508 to store a local copy of the filerequested to be deleted, and may further instruct the remaining sandboxdevices 508 to reference the local copy stored on the one of the sandboxdevices 508.

FIG. 6 illustrates a system 600 for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in response to deletion of the reference to the file on one of thesandbox devices, in accordance with another embodiment. As an option,the system 600 may be implemented in the context of the functionality ofFIGS. 4-5. Of course, however, the system 600 may be implemented in anydesired environment. Again, the aforementioned definitions may applyduring the present description.

As shown, a source device 601 and a plurality of sandbox devices 610-612(e.g. sandbox organizations as shown) are in communication (e.g. via anetwork, etc.). With respect to the present embodiment, the sourcedevice 601 stores a file in a file system of the source device 501, andat least a first one of the sandbox devices 610 stores a reference tosuch file for maintaining a copy of at least a portion of memory of thesource device 601. Also with respect to the present embodiment, areference to the file stored on the first one of the sandbox devices 610is attempted to be deleted (e.g. as a result of a request from a tenantof a multi-tenant on-demand database system, etc.). In response to theattempt, the first sandbox device 610 communicates with the sourcedevice 601, which in turn communicates with the remaining sandboxdevices 612, as described below.

Initially, a delete message queue handler 602 of the first sandboxdevice 610 receives a request to delete the reference to the file. Inresponse to the receipt of the request, the reference to the file isdeleted. Also in response, the delete message queue handler 602 queuesthe request, and subsequently communicates the request (or informationassociated therewith) to a cross-instance handier 604 of the sourcedevice 601. The cross-instance handler 604 of the source device 601responds to the receipt of the request by initiating execution of apolling method 606 of the source device 601. In particular, the pollingmethod 606 requests from each of the other sandbox devices 612 anindication of whether the sandbox devices 612 store the reference to thefile.

As shown, a cross-instance handle 608 of each of the other sandboxdevices 612 receives communication from the polling method 606 (i.e. theaforementioned request for the indication of whether the sandbox devices612 store the reference to the file), and responds to suchcommunication. Thus, the cross-instance handler 608 of each of the othersandbox devices 612 may determine whether the reference is stored by anyof the other sandbox devices 612, and may respond accordingly.

As further shown, the source device 601 deletes the file if the responsereceived from the cross-instance handler 608 of each of the othersandbox devices 612 indicates that the reference to the file is notstored on any of the other sandbox devices 612. In another embodiment,the source device 601 may be prevented from deleting the file if any ofthe responses received from the cross-instance handier 608 of each ofthe other sandbox devices 612 indicates that the reference to the fileis stored on at least one of the other sandbox devices 612. In this way,the source device 601 may optionally automatically delete the filestored thereon, based on the request to delete the reference to the fileon the first sandbox device 610.

As another option, the source device 601 may only initiate the pollingmethod 606 in response to a determination that a database entry utilizedfor tracking the file has been flagged (e.g. where such flag indicatesthat the itself has been requested to be deleted). In one embodiment,the flag may include a reference to the file stored in a database of thesource device 601. Thus, where the file has not previously beenrequested to be deleted and prevented from doing so, the system 600 mayavoid polling the other sandbox devices 612. As an option, if any of theother sandbox devices 612 fails to respond to a request issued by thepolling method 606, the polling method 606 may instruct a delete messagequeue handler (not shown) of the source device 601 to enqueue a requestto delete the file (e.g. such that the polling method 606 may again beinitiated with respect to the request to delete the file).

FIG. 7 illustrates a system 700 for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in response to deletion of one of the sandbox devices, in accordancewith another embodiment. As an option, the system 700 may be implementedin the context of the functionality of FIGS. 4-6. Of course, however,the system 700 may be implemented in any desired environment. Again, theaforementioned definitions may apply during the present description.

As shown, a source device 701 and a plurality of sandbox devices 712-714(e.g. sandbox organizations as shown) are in communication (e.g. via anetwork, etc.). With respect to the present embodiment, the sourcedevice 701 stores a file in a file system of the source device 701, andat least a first one of the sandbox devices 612 stores a reference tosuch file for maintaining a copy of at least a portion of memory of thesource device 701. Also with respect to the present embodiment, anentirety of the contents (e.g. files references) of the first sandboxdevice 712 is attempted to be deleted (e.g. as a result of a requestfrom a tenant of a multi-tenant on-demand database system, etc.). Inresponse to the attempt, the first sandbox device 712 communicates withthe source device 701, which in turn communicates with the remainingsandbox devices 714, as described below.

Initially, a delete message queue handler 702 of the first sandboxdevice 712 receives a request to delete contents of the first sandboxdevice 712. In response to the receipt of the request, the contents aredeleted. Also in response, the delete message queue handler 702 queuesthe request, and subsequently communicates the request e.g. a list ofcontents being deleted) to a cross-instance handler 704 of the sourcedevice 701. The cross-instance handler 704 of the source device 701responds to the receipt of the request by queuing the request in arescan references message handler 706 of the source device 701. Therescan all references message handier 706, in response to receipt of therequest, initiates execution of a polling method 708 of the sourcedevice 701. In particular, the polling method 708 requests from each ofthe other sandbox devices 714 an indication of whether the sandboxdevices 714 store the references to the files being deleted by the firstsandbox device 712. Of course, as another option, the polling method 708may request from each of the other sandbox devices 714 an indication ofwhether the sandbox devices 714 store the references to the filesflagged in a database of the source device 701 (e.g. indicating that thefiles themselves have been requested to be deleted).

As shown, a cross-instance handler 710 of each of the other sandboxdevices 714 receives communication from the polling method 708 (i.e. theaforementioned request for the indication of whether the sandbox devices714 store the references to the files), and responds to suchcommunication. Thus, the cross-instance handler 710 of each of the othersandbox devices 714 may determine whether the references are stored byany of the other sandbox devices 714, and may respond accordingly.

As further shown, for each of the files for which the reference is beingdeleted by virtue of the deletion of the contents of the first sandboxdevice 712, the source device 701 deletes the file if the responsereceived from the cross-instance handler 710 of each of the othersandbox devices 714 indicates that the reference to the file is notstored on any of the other sandbox devices 714. In another embodiment,the source device 701 may be prevented from deleting the file if any ofthe responses received from the cross-instance handler 710 of each ofthe other sandbox devices 714 indicates that the reference to the fileis stored on at least one of the other sandbox devices 714. In this way,the source device 701 may optionally automatically delete the filesstored thereon, based on the request to delete contents of the firstsandbox device 712.

As an option, if any of the other sandbox devices 714 fails to respondto a request issued by the polling method 708, the polling method 708may instruct the rescan all references message handler 706 of the sourcedevice 701 to re-queue the request received from the cross-instancehandler 704 of the source device 701 (e.g. such that the polling method708 may again be initiated with respect to the request).

FIG. 8 illustrates a system 800 for deleting a file stored on a sourcedevice based on a reference to the file on at least one sandbox device,in response to a request to migrate the file from the source device toanother source device, in accordance with still yet another embodiment.As an option, the system 800 may be implemented in the context of thefunctionality of FIGS. 4-7. Of course, however, the system 800 may beimplemented in any desired environment. Again, the aforementioneddefinitions may apply during the present description.

As shown, a source device 801 and at least one sandbox device 808 (e.g.sandbox organization as shown) are in communication (e.g. via a network,etc.). Thus, while a single sandbox device 808 is described below, itshould be noted that the system 800 may be implemented with any numberof different sandbox devices 808. With respect to the presentembodiment, the source device 801 stores a file in a file system of thesource device 801, and the sandbox device 808 stores a reference to suchfile for maintaining a copy of at least a portion of memory of thesource device 801. Also with respect to the present embodiment, the fileis attempted to be moved from the source device 801 to another sourcedevice (not shown) (e.g. as a result of a request from a tenant of amulti-tenant on-demand database system, etc.). In response to theattempt, the source device 801 communicates with the sandbox device 808,as described below.

Initially, a file system to file system migrator 802 of the sourcedevice 801 receives a request to move the file from the source device801 to the other source device. With respect to the present embodiment,the file system to file system migrator 802 may include any method (e.g.Java® method) receiving a request to move the file from the sourcedevice 801 to the other source device. In response, the file system tofile system migrator 802 sends the request to an update referencesmessage handler 804 of the source device 801, such that the updatereferences message handler 804 may queue the request.

Subsequently, the update references message handler 804 requests fromthe sandbox device 806 an indication of whether the sandbox device 806stores the reference to the file requested to be moved. As shown, across-instance handler 806 of the sandbox device 808 receivescommunication from the update references message handler 804 (i.e. theaforementioned request for the indication of whether the sandbox device508 stores the reference to the file requested to be moved), andresponds to such communication. Thus, the cross-instance handler 806 maydetermine whether the reference is stored by the sandbox device 808, andmay respond accordingly.

As further shown, the source device 801 moves the file to the othersource device if the response received from the cross-instance handler806 indicates that the reference to the file is not stored on thesandbox device 808. In another embodiment, if the response received fromthe cross-instance handler 806 indicates that the reference to the fileis stored on the sandbox device 808, the source device 801 may move thefile to the other source device and instruct the sandbox device 808 toupdate its reference to reference the file now stored on the othersource device. As an option, if the sandbox device 808 fails to respondto a request issued by the update references message handler 804, theupdate references message handler 804 may re-queue the request to movethe file.

System Overview

FIG. 9 illustrates a block diagram of an environment 910 wherein anon-demand database service might be used. Environment 910 may includeuser systems 912, network 914, system 916, processor system 917,application platform 918, network interface 920, tenant data storage922, system data storage 924, program code 926, and process space 928.In other embodiments, environment 10 may not have all of the componentslisted and/or may have other elements instead of, or in addition to,those listed above.

Environment 910 is an environment in which an on-demand database serviceexists. User system 912 may be any machine or system that is used by auser to access a database user system. For example, any of user systems912 can be a handheld computing device, a mobile phone, a laptopcomputer, a work station, and/or a network of computing devices. Asillustrated in FIG. 9 (and in more detail in FIG. 10) user systems 912might interact via a network 914 with an on-demand database service,which is system 916.

An on-demand database service, such as system 916, is a database systemthat is made available to outside users that do not need to necessarilybe concerned with building and/or maintaining the database system, hutinstead may be available for their use when the users need the databasesystem (e.g., on the demand of the users). Some on-demand databaseservices may store information from one or more tenants stored intotables of a common database image to form a multi-tenant database system(MTS). Accordingly, “on-demand database service 916” and “system 916”will be used interchangeably herein. A database image may include one ormore database objects. A relational database management system (RDMS) orthe equivalent may execute storage and retrieval of information againstthe database object(s). Application platform 918 may be a framework thatallows the applications of system 916 to run, such as the hardwareand/or software, e.g., the operating system. In an embodiment, on-demanddatabase service 916 may include an application platform 918 thatenables creation, managing and executing one or more applicationsdeveloped by the provider of the on-demand database service, usersaccessing the on-demand database service via user systems 912, or thirdparty application developers accessing the on-demand database servicevia user systems 912.

The users of user systems 912 may differ in their respective capacities,and the capacity of a particular user system 912 might be entirelydetermined by permissions (permission levels) for the current user. Forexample, where a salesperson is using a particular user system 912 tointeract with system 916, that user system has the capacities allottedto that salesperson. However, while an administrator is using that usersystem to interact with system 916, that user system has the capacitiesallotted to that administrator. In systems with a hierarchical rolemodel, users at one permission level may have access to applications,data, and database information accessible by a lower permission leveluser, but may not have access to certain applications, databaseinformation, and data accessible by a user at a higher permission level.Thus, different users will have different capabilities with regard toaccessing and modifying application and database information, dependingon a user's security or permission level.

Network 914 is any network or combination of networks of devices thatcommunicate with one another. For example, network 914 can be any one orany combination of a LAN (local area network), WAN (wide area network),telephone network, wireless network, point-to-point network, starnetwork, token ring network, hub network, or other appropriateconfiguration. As the most common type of computer network in currentuse is a TCP/IP (Transfer Control Protocol and Internet Protocol)network, such as the global internetwork of networks often referred toas the “Internet” with a capital “I,” that network will be used in manyof the examples herein. However, it should be understood that thenetworks that the one or more implementations might use are not solimited, although TCP/IP is a frequently implemented protocol.

User systems 912 might communicate with system 916 using TCP/IP and, ata higher network level, use other common Internet protocols tocommunicate, such as HTTP, FTP, AFS, WAP, etc. In an example where HTTPis used, user system 912 might include an HTTP client commonly referredto as a “browser” for sending and receiving HTTP messages to and from anHTTP server at system 916. Such an HTTP server might be implemented asthe sole network interface between system 916 and network 914, but othertechniques might be used as well or instead. In some implementations,the interface between system 916 and network 914 includes load sharingfunctionality, such as round-robin HTTP request distributors to balanceloads and distribute incoming HTTP requests evenly over a plurality ofservers. At least as for the users that are accessing that server, eachof the plurality of servers has access to the MTS' data however, otheralternative configurations may be used instead.

In one embodiment, system 916, shown in FIG. 9, implements a web-basedcustomer relationship management (CRM) system. For example, in oneembodiment, system 916 includes application servers configured toimplement and execute CRM software applications as well as providerelated data, code, forms, webpages and other information to and fromuser systems 912 and to store to, and retrieve from, a database systemrelated data, objects, and Webpage content. With a multi-tenant system,data for multiple tenants may be stored in the same physical databaseobject, however, tenant data typically is arranged so that data of onetenant is kept logically separate from that of other tenants so that onetenant does not have access to another tenant's data, unless such datais expressly shared. In certain embodiments, system 916 implementsapplications other than, or in addition to, a CRM application. Forexample, system 916 may provide tenant access to multiple hosted(standard and custom) applications, including a CRM application. User(or third party developer) applications, which may or may not includeCRM, may be supported by the application platform 918, which managescreation, storage of the applications into one or more database objectsand executing of the applications in a virtual machine in the processspace of the system 916.

One arrangement for elements of system 916 is shown in FIG. 9, includinga network interface 920, application platform 918, tenant data storage922 for tenant data 923, system data storage 924 for system data 925accessible to system 916 and possibly multiple tenants, program code 926for implementing various functions of system 916, and a process space928 for executing MTS system processes and tenant-specific processes,such as running applications as part of an application hosting service.Additional processes that may execute on system 916 include databaseindexing processes.

Several elements in the system shown in FIG. 9 include conventional,well-known elements that are explained only briefly here. For example,each user system 912 could include a desktop personal computer,workstation, laptop, PDA, cell phone, or any wireless access protocol(WAP) enabled device or any other computing device capable ofinterfacing directly or indirectly to the Internet or other networkconnection. User system 912 typically runs an HTTP client, e.g., abrowsing program, such as Microsoft's Internet Explorer browser,Netscape's Navigator browser, Opera's browser, or a WAP-enabled browserin the case of a cell phone, PDA or other wireless device, or the like,allowing a user (e.g., subscriber of the multi-tenant database system)of user system 912 to access, process and view information, pages andapplications available to it from system 916 over network 914. Each usersystem 912 also typically includes one or more user interface devices,such as a keyboard, a mouse, trackball, touch pad, touch screen, pen orthe like, for interacting with a graphical user interface (GUI) providedby the browser on a display (e.g., a monitor screen, LCD display, etc.)in conjunction with pages, forms, applications and other informationprovided by system 916 or other systems or servers. For example, theuser interface device can be used to access data and applications hostedby system 916, and to perform searches on stored data, and otherwiseallow a user to interact with various GUI pages that may be presented toa user. As discussed above, embodiments are suitable for use with theInternet, which refers to a specific global internetwork of networks.However, it should be understood that other networks can be used insteadof the Internet, such as an intranet, an extranet, a virtual privatenetwork (VPN), a non-TCP/IP based network, any LAN or WAN or the like.

According to one embodiment, each user system 912 and all of itscomponents are operator configurable using applications, such as abrowser, including computer code run using a central processing unitsuch as an Intel Pentium® processor or the like. Similarly, system 916(and additional instances of an MTS, where more than one is present) andall of their components might be operator configurable usingapplication(s) including computer code to run using a central processingunit such as processor system 917, which may include an Intel Pentium®processor or the like, and/or multiple processor units. A computerprogram product embodiment includes a machine-readable storage medium(media) having instructions stored thereon/in which can be used toprogram a computer to perform any of the processes of the embodimentsdescribed herein. Computer code for operating and configuring system 916to intercommunicate and to process webpages, applications and other dataand media content as described herein are preferably downloaded andstored on a hard disk, hut the entire program code, or portions thereof,may also be stored in any other volatile or non-volatile memory mediumor device as is well known, such as a ROM or RAM, or provided on anymedia capable of storing program code, such as any type of rotatingmedia including floppy disks, optical discs, digital versatile disk(DVD), compact disk (CD), microdrive, and magneto-optical disks, andmagnetic or optical cards, nanosystems (including molecular memory ICs),or any type of media or device suitable for storing instructions and/ordata. Additionally, the entire program code, or portions thereof, may betransmitted and downloaded from a software source over a transmissionmedium, e.g., over the Internet, or from another server, as is wellknown, or transmitted over any other conventional network connection asis well known (e.g., extranet, VPN, LAN, etc.) using any communicationmedium and protocols (e.g., TCP/IP, HTTP, HTTPS, Ethernet, etc.) as arewell known. It will also be appreciated that computer code forimplementing embodiments can be implemented in any programming languagethat can be executed on a client system and/or server or server systemsuch as, for example, C, C++, HTML, any other markup language, Java™,JavaScript, ActiveX, any other scripting language, such as VBScript, andmany other programming languages as are well known may be used. (Java™is a trademark of Sun Microsystems, Inc.).

According to one embodiment, each system 916 is configured to providewebpages, forms, applications, data and media content to user (client)systems 912 to support the access by user systems 912 as tenants ofsystem 916. As such, system 916 provides security mechanisms to keepeach tenant's data separate unless the data is shared. If more than oneMTS is used, they may be located in close proximity to one another(e.g., in a server farm located in a single building or campus), or theymay be distributed at locations remote from one another (e.g., one ormore servers located in city A and one or more servers located in cityB). As used herein, each MTS could include one or more logically and/orphysically connected servers distributed locally or across one or moregeographic locations. Additionally, the term “server” is meant toinclude a computer system, including processing hardware and processspace(s), and an associated storage system and database application(e.g., OODBMS or RDBMS) as is well known in the art. It should also beunderstood that “server system” and “server” are often usedinterchangeably herein. Similarly, the database object described hereincan be implemented as single databases, a distributed database, acollection of distributed databases, a database with redundant online oroffline backups or other redundancies, etc., and might include adistributed database or storage network and associated processingintelligence.

FIG. 10 also illustrates environment 910. However, in FIG. 10 elementsof system 916 and various interconnections in an embodiment are furtherillustrated. FIG. 10 shows that user system 912 may include processorsystem 912A, memory system 912B, input system 912C, and output system912D. FIG. 10 shows network 914 and system 916. FIG. 10 also shows thatsystem 916 may include tenant data storage 922, tenant data 923, systemdata storage 924, system data 925, User Interface (UI) 1030, ApplicationProgram Interface (API) 1032, PL/SOQL 1034, save routines 1036,application setup mechanism 1038, applications servers 1000 ₁-1000 _(N),system process space 1002, tenant process spaces 1004, tenant managementprocess space 1010, tenant storage area 1012, user storage 1014, andapplication metadata 1016. In other embodiments, environment 910 may nothave the same elements as those listed above and/or may have otherelements instead of, or in addition to, those listed above.

User system 912, network 914, system 916, tenant data storage 922, andsystem data storage 924 were discussed above in FIG. 9. Regarding usersystem 912, processor system 912A may be any combination of one or moreprocessors. Memory system 912B may be any combination of one or morememory devices, short term, and/or long term memory. Input system 912Cmay be any combination of input devices, such as one or more keyboards,mice, trackballs, scanners, cameras, and/or interfaces to networks.Output system 9121) may be any combination of output devices, such asone or more monitors, printers, and/or interfaces to networks. As shownby FIG. 10, system 916 may include a network interface 920 (of FIG. 9)implemented as a set of HTTP application servers 1000, an applicationplatform 918, tenant data storage 922, and system data storage 924. Alsoshown is system process space 1002, including individual tenant processspaces 1004 and a tenant management process space 1010. Each applicationserver 1000 may be configured to tenant data storage 922 and the tenantdata 923 therein, and system data storage 924 and the system data 925therein to serve requests of user systems 912. The tenant data 923 mightbe divided into individual tenant storage areas 1012, which can beeither a physical arrangement and/or a logical arrangement of data.Within each tenant storage area 1012, user storage 1014 and applicationmetadata 1016 might be similarly allocated for each user. For example, acopy of a user's most recently used (MRU) items might be stored to userstorage 1014. Similarly, a copy of MRU items for an entire organizationthat is a tenant might be stored to tenant storage area 1012. A UI 1030provides a user interface and an API 1032 provides an applicationprogrammer interface to system 916 resident processes to users and/ordevelopers at user systems 912. The tenant data and the system data maybe stored in various databases, such as one or more Oracle™ databases.

Application platform 918 includes an application setup mechanism 1038that supports application developers' creation and management ofapplications, which may be saved as metadata into tenant data storage922 by save routines 1036 for execution by subscribers as one or moretenant process spaces 1004 managed by tenant management process 1010 forexample. Invocations to such applications may be coded using PL/SOQL1034 that provides a programming language style interface extension toAPI 1032. A detailed description of some PL/SOQL language embodiments isdiscussed in commonly owned co-pending U.S. Provisional PatentApplication 60/828,192 entitled, PROGRAMMING LANGUAGE METHOD AND SYSTEMFOR EXTENDING APIS TO EXECUTE IN CONJUNCTION WITH DATABASE APIS, byCraig Weissman, filed Oct. 4, 2006, which is incorporated in itsentirety herein for all purposes. Invocations to applications may bedetected by one or more system processes, which manages retrievingapplication metadata 1016 for the subscriber making the invocation andexecuting the metadata as an application in a virtual machine.

Each application server 1000 may be communicably coupled to databasesystems, e.g., having access to system data 925 and tenant data 923, viaa different network connection. For example, one application server 1000₁ might be coupled via the network 914 (e.g., the Internet), anotherapplication server 1000 _(N-1) might be coupled via a direct networklink, and another application server 1000 _(N) might be coupled by yet adifferent network connection. Transfer Control Protocol and InternetProtocol (TCP/IP) are typical protocols for communicating betweenapplication servers 1000 and the database system. However, it will beapparent to one skilled in the art that other transport protocols may beused to optimize the system depending on the network interconnect used.

In certain embodiments, each application server 1000 is configured tohandle requests for any user associated with any organization that is atenant. Because it is desirable to be able to add and remove applicationservers from the server pool at any time for any reason, there ispreferably no server affinity for a user and/or organization to aspecific application server 1000. In one embodiment, therefore, aninterface system implementing a load balancing function (e.g., an F5Big-IP load balancer) is communicably coupled between the applicationservers 1000 and the user systems 912 to distribute requests to theapplication servers 1000. In one embodiment, the load balancer uses aleast connections algorithm to route user requests to the applicationservers 1000. Other examples of load balancing algorithms, such as roundrobin and observed response time, also can be used. For example, incertain embodiments, three consecutive requests from the same user couldhit three different application servers 1000, and three requests fromdifferent users could hit the same application server 1000. In thismanner, system 916 is multi-tenant, wherein system 916 handles storageof, and access to, different objects, data and applications acrossdisparate users and organizations.

As an example of storage, one tenant might be a company that employs asales force where each salesperson uses system 916 to manage their salesprocess. Thus, a user might maintain contact data, leads data, customerfollow-up data, performance data, goals and progress data, etc., allapplicable to that user's personal sales process (e.g., in tenant datastorage 922). In an example of a MTS arrangement, since all of the dataand the applications to access, view, modify, report, transmit,calculate, etc., can be maintained and accessed by a user system havingnothing more than network access, the user can manage his or her salesefforts and cycles from any of many different user systems. For example,if a salesperson is visiting a customer and the customer has Internetaccess in their lobby, the salesperson can obtain critical updates as tothat customer while waiting for the customer to arrive in the lobby.

While each user's data might be separate from other users' dataregardless of the employers of each user, some data might beorganization-wide data shared or accessible by a plurality of users orall of the users for a given organization that is a tenant. Thus, theremight be some data structures managed by system 916 that are allocatedat the tenant level while other data structures might be managed at theuser level. Because an MTS might support multiple tenants includingpossible competitors, the MTS should have security protocols that keepdata, applications, and application use separate. Also, because manytenants may opt for access to an MTS rather than maintain their ownsystem, redundancy, up-time, and backup are additional functions thatmay be implemented in the MTS. In addition to user-specific data andtenant specific data, system 916 might also maintain system level datausable by multiple tenants or other data. Such system level data mightinclude industry reports, news, postings, and the like that are sharableamong tenants.

In certain embodiments, user systems 912 (which may be client systems)communicate with application servers 1000 to request and updatesystem-level and tenant-level data from system 916 that may requiresending one or more queries to tenant data storage 922 and/or systemdata storage 924. System 916 an application server 1000 in system 916)automatically generates one or more SQL statements (e.g., one or moreSQL queries) that are designed to access the desired information. Systemdata storage 924 may generate query plans to access the requested datafrom the database.

Each database can generally be viewed as a collection of objects, suchas a set of logical tables, containing data fitted into predefinedcategories. A “table” is one representation of a data object, and may beused herein to simplify the conceptual description of objects and customobjects. It should be understood that “table” and “object” may be usedinterchangeably herein. Each table generally contains one or more datacategories logically arranged as columns or fields in a viewable schema.Each row or record of a table contains an instance of data for eachcategory defined by the fields. For example, a CRM database may includea table that describes a customer with fields for basic contactinformation such as name, address, phone number, fax number, etc.Another table might describe a purchase order, including fields forinformation such as customer, product, sale price, date, etc. In somemulti-tenant database systems, standard entity tables might be providedfor use by all tenants. For CRM database applications, such standardentities might include tables for Account, Contact, Lead, andOpportunity data, each containing pre-defined fields. It should beunderstood that the word “entity” may also be used interchangeablyherein with “object” and “table”.

In some multi-tenant database systems, tenants may be allowed to createand store custom objects, or they may be allowed to customize standardentities or objects, for example by creating custom fields for standardobjects, including custom index fields. U.S. patent application Ser. No.10/817,161, filed Apr. 2, 2004, entitled “Custom Entities and Fields ina Multi-Tenant Database System”, and which is hereby incorporated hereinby reference, teaches systems and methods for creating custom objects aswell as customizing standard objects in a multi-tenant database system.In certain embodiments, for example, all custom entity data rows arestored in a single multi-tenant physical table, which may containmultiple logical tables per organization. It is transparent to customersthat their multiple “tables” are in fact stored in one large table orthat their data may be stored in the same table as the data of othercustomers.

While one or more implementations have been described by way of exampleand in terms of the specific embodiments, it is to be understood thatone or more implementations are not limited to the disclosedembodiments. To the contrary, it is intended to cover variousmodifications and similar arrangements as would be apparent to thoseskilled in the art. Therefore, the scope of the appended claims shouldbe accorded the broadest interpretation so as encompass all suchmodifications and similar arrangements.

1. A computer program product embodied on a tangible computer readablemedium, comprising: computer code for identifying a plurality of fileslocated on a multi-tenant on-demand database system, each of the filesbelow a threshold size; computer code for concatenating the files tocreate a single concatenated file; and computer code for storing thesingle concatenated file in a file system of the multi-tenant on-demanddatabase system.
 2. The computer program product of claim 1, wherein thecomputer program product is operable such that the files are identifiedfrom a database of the multi-tenant on-demand database system that isseparate from the file system.
 3. The computer program product of claim2, wherein the files are stored in the database in response to adetermination that each of the files is below the threshold size.
 4. Thecomputer program product of claim 1, wherein the computer programproduct is operable such that the files are identified from the filesystem.
 5. The computer program product of claim 1, wherein the singleconcatenated file stores data including each of the files, and for eachof the files an indicator of a length of the file and a checksum of thefile.
 6. The computer program product of claim 1, further comprisingcomputer code for, in response to the storage of the single concatenatedfile in the file system, deleting the files and storing a pointer toeach of the files in a database separate from the file system.
 7. Thecomputer program product of claim 6, further comprising computer codefor: receiving a request to delete one of the files; and storing a flagin an entry of the database associated with the one of the files, inresponse to the request.
 8. The computer program product of claim 7,further comprising computer code for determining whether flagged filesincluded in the single concatenated file are of at least a predeterminedsize.
 9. The computer program product of claim 9, further comprisingcomputer, code for, in response to a determination that the flaggedfiles included in the single concatenated file are of at least thepredetermined size, concatenating the single concatenated file withanother single concatenated file or at least one other file located inthe multi-tenant on-demand database system that is below the thresholdsize.
 10. A method, comprising: identifying a plurality of files locatedon a multi-tenant on-demand database system, each of the files below athreshold size; concatenating the files to create a single concatenatedfile; and storing the single concatenated file in a file system of themulti-tenant on-demand database system.
 11. An apparatus, comprising: aprocessor for: identifying a plurality of files located on amulti-tenant on-demand database system, each of the files below athreshold size; concatenating the files to create a single concatenatedfile; and storing the single concatenated file in a file system of themulti-tenant on-demand database system.
 12. A method for transmittingcode, comprising: transmitting code to identify a plurality of fileslocated on a multi-tenant on-demand database system, each of the filesbelow a threshold size; transmitting code to concatenate the files tocreate a single concatenated file; and transmitting code to store thesingle concatenated file in a file system of the multi-tenant on-demanddatabase system.
 13. A computer program product embodied on a tangiblecomputer readable medium, comprising: computer code for identifyingcontent stored in a file system of a first device of a multi-tenanton-demand database system; and computer code for storing a reference tothe content on a second device of the multi-tenant on-demand databasesystem for maintaining on the second device a copy of at least a portionof memory of the first device.
 14. The computer program product of claim13, wherein the content includes a file and the reference includes apointer to the file in the file system of the first device.
 15. Thecomputer program product of claim 13, wherein the second device includesa sandbox organization copy of the portion of memory of the firstdevice.
 16. The computer program product of claim 13, furthercomprising: computer code for receiving a request at the first device todelete the content; computer code for determining that the reference tothe content is stored on the second device; and computer code forpreventing deletion of the content stored in the file system of thefirst device, based on the determination.
 17. The computer programproduct of claim 13, wherein the computer program product is operablesuch that at least one third device of the multi-tenant on-demanddatabase service stores the reference to the content for maintaining onthe at least one third device the copy of the least a portion of thememory of the first device.
 18. The computer program product of claim17, further comprising: computer code for receiving at the first devicean indication that the reference to the content on the second device isdeleted; computer code for determining that the reference to the contentis stored on the at least one third device; and computer code forpreventing deletion of the content stored in the file system of thefirst device, based on the determination.
 19. The computer programproduct of claim 18, wherein the computer program product is operablesuch that the determination that the reference to the content is storedon the at least one third device is conditionally made based on adetermination of whether the reference to the content is stored in adatabase of the first device.
 20. The computer program product of claim19, wherein the computer program product is operable such that thedetermination that the reference to the content is stored on the atleast one third device prevented in response to a determination that thereference to the content is not stored in the database of the firstdevice.